/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package algorithm;

/** Loosely maps onto the environment that an individual evolves in. It contains
 * information as to how the individual is represented in this enviroment
 * (the phenotype) and also the means to determine the fitness of an individual
 * in this environmet (the objective function)
 *
 * @author vermaak
 */
public class Environment {
    private ObjectiveFunction objectiveFunction;
    private Encoder encoder;

    public Environment(ObjectiveFunction objectiveFunction, Encoder encoder) {
        this.objectiveFunction = objectiveFunction;
        this.encoder = encoder;
    }

    public Encoder getEncoder() {
        return encoder;
    }

    public ObjectiveFunction getObjectiveFunction() {
        return objectiveFunction;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Environment other = (Environment) obj;
        if (this.objectiveFunction != other.objectiveFunction && (this.objectiveFunction == null || !this.objectiveFunction.equals(other.objectiveFunction))) {
            return false;
        }
        if (this.encoder != other.encoder && (this.encoder == null || !this.encoder.equals(other.encoder))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 53 * hash + (this.objectiveFunction != null ? this.objectiveFunction.hashCode() : 0);
        hash = 53 * hash + (this.encoder != null ? this.encoder.hashCode() : 0);
        return hash;
    }
    
    
    
    
}
